Skip to content

AT Protocol demo scripts#461

Draft
cassidyjames wants to merge 19 commits into
mainfrom
cassidyjames/atproto-demo
Draft

AT Protocol demo scripts#461
cassidyjames wants to merge 19 commits into
mainfrom
cassidyjames/atproto-demo

Conversation

@cassidyjames
Copy link
Copy Markdown
Member

@cassidyjames cassidyjames commented May 13, 2026

This is my branch I've been using for demos locally and on Codespace. It adds two scripts:

  • atproto:setup to create item types under the given org
  • atproto:demo to actually feed items to Coop

My goal is for this branch to track main and not touch anything else in the codebase besides these scripts to keep things self-contained and reproducible.

Usage:

  1. Create the item types (run once after npm run create-org):

    cd server && npm run atproto:setup -- --org-id <orgId>

    Copy the item type ID printed at the end.

  2. Start the firehose connector (in a separate terminal):

    npm run atproto:demo -- --api-key <apiKey> --post-type-id <postTypeId>

Posts from the Bluesky firehose will be processed by automated rules as they arrive. The connector defaults to 100 submissions per minute; pass --rate-limit <n> to adjust. Use --dry-run to preview submissions without sending them.

There's probably a lot that can be improved, hence the draft status; I'm just opening this PR for visibility for now. :) Off the top of my head:

  • Submit reports in addition to items so we can demo reports
    • Random posts, or maybe scope it to an allowlist of known accounts for demos
  • Clean up the scripts (it's weird one is in server and the other is not)

@coderabbitai

This comment has been minimized.

Replace the placeholder `authorHandle: did` with separate `did`,
`handle`, and `displayName` fields populated via the Bluesky public
profile API. Profiles are cached per-DID to avoid redundant lookups.

Also renames the item types in atproto-setup from "Bluesky" to "atproto"
and adds `did` and `displayName` to the post schema.
@cassidyjames cassidyjames force-pushed the cassidyjames/atproto-demo branch from c43ca56 to 2bd8450 Compare May 15, 2026 20:03
cassidyjames and others added 16 commits May 18, 2026 10:25
# Conflicts:
#	README.md
#	server/package.json
Collect a random cross-section of up to 20 posts from the firehose
using reservoir-style replacement. Sampling is independent of the
item rate limit so the buffer stays populated even when throughput
is high. This is groundwork for the report submission added next.
Picks a random post from the sample buffer every 60 seconds and
submits it to /api/v1/report using the post's author DID as the
reporter. Requires --user-type-id (from atproto:setup). Reports are
skipped gracefully if the arg is omitted. Dry-run mode supported.
Reports now go through the same token-bucket pattern as items: each
incoming post attempts to consume a report token, with a configurable
--report-rate-limit flag (default: 1/min). This removes the sample
buffer and the fixed setInterval in favor of something simpler and
more flexible.
bsky.app blocks direct embedding (X-Frame-Options: SAMEORIGIN), so the
review iframe needs a proxy. atproto-proxy.mts is a minimal Node HTTP
server (port 4000) that fetches post data from the Bluesky public API
and renders it as a standalone HTML page, including postMessage support
for the review UI's blur/grayscale wellness settings.

Also documents VITE_CONTENT_URL_PATTERN=bsky.app as required in
client/.env for Bluesky URLs to trigger the iframe in the first place.
Adds five optional embed fields to the atproto Post item type schema
(embedType, embedUrl, embedTitle, embedDescription, embedThumb) so Coop
rules can match on linked URLs and link preview content.

Also adds --post-type-id / --user-type-id flags to atproto-setup so it
can be run against an existing org to update item types rather than
always creating new ones. Passes the full schema on update to avoid
relying on merge behavior.

Fixes "Bluesky" → "AT Protocol" in user-facing strings in the setup
script and README.
Extends BlueskyPost and CoopItem to capture embed data from raw AT
Protocol firehose records. postToCoopItem() now maps embedType for all
embed types, and embedUrl/embedTitle/embedDescription for external link
embeds. embedThumb is omitted since blob URLs aren't resolved in raw
firehose records.

Also fixes "Bluesky" → "atproto" / "AT Protocol" in comments and option
descriptions.
Adds renderEmbed() to the proxy, handling all five AT Protocol embed
types: external link cards (thumbnail, title, description, hostname),
image grids (up to 4 images, 1- or 2-column), video thumbnails with
play overlay, quoted posts, and recordWithMedia. Unknown embed types
return empty string for forward compatibility.

Also fixes "Bluesky" → "atproto"/"bsky.app" terminology in the proxy's
user-facing strings.
Applying the filter to `document.body` blurred the entire iframe—text,
author name, card border, everything. Targeting only `img` elements via
a CSS custom property (`--img-filter`) keeps text and layout readable
while still blurring images and video/link card thumbnails.
Moderators need a way to reveal blurred images without toggling the blur
setting entirely. Hovering over an image now temporarily removes the
filter, with the existing transition making the reveal smooth.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant